<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>tinyOS: tSwitch.c Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">tinyOS
   &#160;<span id="projectnumber">v1.00</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('t_switch_8c_source.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">tSwitch.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="t_switch_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;</div><div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="tiny_o_s_8h.html">tinyOS.h</a>&quot;</span></div><div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor">#include &quot;stm32f10x.h&quot;</span></div><div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;</div><div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment">// 在任务切换中，主要依赖了PendSV进行切换。PendSV其中的一个很重要的作用便是用于支持RTOS的任务切换。</span></div><div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment">// 实现方法为：</span></div><div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment">// 1、首先将PendSV的中断优先配置为最低。这样只有在其它所有中断完成后，才会触发该中断；</span></div><div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment">//    实现方法为：向NVIC_SYSPRI2写NVIC_PENDSV_PRI</span></div><div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment">// 2、在需要中断切换时，设置挂起位为1，手动触发。这样，当没有其它中断发生时，将会引发PendSV中断。</span></div><div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment">//    实现方法为：向NVIC_INT_CTRL写NVIC_PENDSVSET</span></div><div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment">// 3、在PendSV中，执行任务切换操作。</span></div><div class="line"><a name="l00024"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gafa1ca44ad548bf5bfa2f19d7438c722a">   24</a></span>&#160;<span class="preprocessor">#define NVIC_INT_CTRL       0xE000ED04      // 中断控制及状态寄存器</span></div><div class="line"><a name="l00025"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga11166a59c430ba34e6da8e20571b58d7">   25</a></span>&#160;<span class="preprocessor">#define NVIC_PENDSVSET      0x10000000      // 触发软件中断的值</span></div><div class="line"><a name="l00026"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga23694ffa1ac38dfdfcc1ae1160be7397">   26</a></span>&#160;<span class="preprocessor">#define NVIC_SYSPRI2        0xE000ED22      // 系统优先级寄存器</span></div><div class="line"><a name="l00027"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga3612aa5e26b7da530145fdddce3850ce">   27</a></span>&#160;<span class="preprocessor">#define NVIC_PENDSV_PRI     0x000000FF      // 配置优先级</span></div><div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;</div><div class="line"><a name="l00029"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gade1e623e8a7851917439eeac2019ff3f">   29</a></span>&#160;<span class="preprocessor">#define MEM32(addr)         *(volatile unsigned long *)(addr)</span></div><div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gac66df9e288958f808f7308f40d5ebd66">   30</a></span>&#160;<span class="preprocessor">#define MEM8(addr)          *(volatile unsigned char *)(addr)</span></div><div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;</div><div class="line"><a name="l00036"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gab4d6c802c474b9071f48312bed3dec74">   36</a></span>&#160;uint32_t <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gab4d6c802c474b9071f48312bed3dec74">tTaskEnterCritical</a> (<span class="keywordtype">void</span>) {</div><div class="line"><a name="l00037"></a><span class="lineno">   37</span>&#160;    uint32_t primask = __get_PRIMASK();</div><div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    __disable_irq();        <span class="comment">// CPSID I</span></div><div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;    <span class="keywordflow">return</span> primask;</div><div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160;}</div><div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;</div><div class="line"><a name="l00047"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga21b4efbc4cb710d7d0e71678d2b13e53">   47</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga21b4efbc4cb710d7d0e71678d2b13e53">tTaskExitCritical</a> (uint32_t status) {</div><div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    __set_PRIMASK(status);</div><div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;}</div><div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;</div><div class="line"><a name="l00054"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gad628297c6eafc9b3a38fdd08377b42c5">   54</a></span>&#160;__asm <span class="keywordtype">void</span> <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gad628297c6eafc9b3a38fdd08377b42c5">PendSV_Handler</a> (<span class="keywordtype">void</span>) { </div><div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;    IMPORT <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gae823575cc1cd55db2bbc40292ec5d9e7">saveAndLoadStackAddr</a>         <span class="comment">// 汇编代码中导入外部符号，类似C中的extern声明</span></div><div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160;                                        <span class="comment">// 进入异常前，硬件会自动将R0~R3等内核寄存器保存到PSP堆栈中</span></div><div class="line"><a name="l00057"></a><span class="lineno">   57</span>&#160;    MRS     R0, PSP                     <span class="comment">// 获取PSP，其当前指向正在运行任务的栈中</span></div><div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    STMDB   R0!, {R4-R11}               <span class="comment">// 将未自动保存到任务栈中的R4-R11寄存器保存到任务栈</span></div><div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;</div><div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;    BL      <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gae823575cc1cd55db2bbc40292ec5d9e7">saveAndLoadStackAddr</a>        <span class="comment">// 调用saveAndLoadStackAddr,在这里负责切换堆栈</span></div><div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div><div class="line"><a name="l00062"></a><span class="lineno">   62</span>&#160;    LDMIA   R0!, {R4-R11}               <span class="comment">// 从将要运行的任务栈中，加载R4-R11的值到内核寄存器</span></div><div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    MSR     PSP, R0                     <span class="comment">// 之后，调用PSP的栈指针为将要运行的任务本</span></div><div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    </div><div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    MOV     LR, #0xFFFFFFFD             <span class="comment">// 指明退出异常时，使用PSP堆栈。0xFFFFFFFD含义特殊</span></div><div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    BX      LR                          <span class="comment">// 如需了解含义，请查资料。之后退出异常，硬件自动弹出R0~R3等寄存器</span></div><div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;}</div><div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160;</div><div class="line"><a name="l00074"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gae823575cc1cd55db2bbc40292ec5d9e7">   74</a></span>&#160;uint32_t <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gae823575cc1cd55db2bbc40292ec5d9e7">saveAndLoadStackAddr</a> (uint32_t stackAddr) {</div><div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;    <span class="keywordflow">if</span> (<a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga6f232fb9d8361d1071e4f621468e0ee1">currentTask</a> != (<a class="code" href="struct__t_task.html">tTask</a> *)0) {</div><div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;        <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga6f232fb9d8361d1071e4f621468e0ee1">currentTask</a>-&gt;<a class="code" href="struct__t_task.html#a1abf78464029077a8080178b9e04745c">stack</a> = (uint32_t *)stackAddr;</div><div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    }</div><div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga6f232fb9d8361d1071e4f621468e0ee1">currentTask</a> = <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga159b80359c1c58e1541a4f037178b6c4">nextTask</a>;</div><div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <span class="keywordflow">return</span> (uint32_t)<a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga6f232fb9d8361d1071e4f621468e0ee1">currentTask</a>-&gt;<a class="code" href="struct__t_task.html#a1abf78464029077a8080178b9e04745c">stack</a>;</div><div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;}</div><div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;</div><div class="line"><a name="l00085"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga0fb8703674b7e263ae5b825af16cbce5">   85</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga0fb8703674b7e263ae5b825af16cbce5">tTaskRunFirst</a> () {</div><div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    __set_PSP(__get_MSP());</div><div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;</div><div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gac66df9e288958f808f7308f40d5ebd66">MEM8</a>(<a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga23694ffa1ac38dfdfcc1ae1160be7397">NVIC_SYSPRI2</a>) = <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga3612aa5e26b7da530145fdddce3850ce">NVIC_PENDSV_PRI</a>;   <span class="comment">// 向NVIC_SYSPRI2写NVIC_PENDSV_PRI，设置其为最低优先级</span></div><div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;</div><div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gade1e623e8a7851917439eeac2019ff3f">MEM32</a>(<a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gafa1ca44ad548bf5bfa2f19d7438c722a">NVIC_INT_CTRL</a>) = <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga11166a59c430ba34e6da8e20571b58d7">NVIC_PENDSVSET</a>;    <span class="comment">// 向NVIC_INT_CTRL写NVIC_PENDSVSET，用于PendSV</span></div><div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;</div><div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="comment">// 可以看到，这个函数是没有返回</span></div><div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;    <span class="comment">// 这是因为，一旦触发PendSV后，将会在PendSV后立即进行任务切换，切换至第1个任务运行</span></div><div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160;    <span class="comment">// 此后，tinyOS将负责管理所有任务的运行，永远不会返回到该函数运行</span></div><div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;}</div><div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga0cd2c487eac7429325389fa3ee59867d">  100</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga0cd2c487eac7429325389fa3ee59867d">tTaskSwitch</a> () {</div><div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="comment">// 和tTaskRunFirst, 这个函数会在某个任务中调用，然后触发PendSV切换至其它任务</span></div><div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    <span class="comment">// 之后的某个时候，将会再次切换到该任务运行，此时，开始运行该行代码, 返回到</span></div><div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    <span class="comment">// tTaskSwitch调用处继续往下运行</span></div><div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160;    <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gade1e623e8a7851917439eeac2019ff3f">MEM32</a>(<a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gafa1ca44ad548bf5bfa2f19d7438c722a">NVIC_INT_CTRL</a>) = <a class="code" href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga11166a59c430ba34e6da8e20571b58d7">NVIC_PENDSVSET</a>;  <span class="comment">// 向NVIC_INT_CTRL写NVIC_PENDSVSET，用于PendSV</span></div><div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;}</div><div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;</div><div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_gad628297c6eafc9b3a38fdd08377b42c5"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gad628297c6eafc9b3a38fdd08377b42c5">PendSV_Handler</a></div><div class="ttdeci">__asm void PendSV_Handler(void)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00054">tSwitch.c:54</a></div></div>
<div class="ttc" id="struct__t_task_html_a1abf78464029077a8080178b9e04745c"><div class="ttname"><a href="struct__t_task.html#a1abf78464029077a8080178b9e04745c">_tTask::stack</a></div><div class="ttdeci">uint32_t * stack</div><div class="ttdef"><b>Definition:</b> <a href="t_task_8h_source.html#l00036">tTask.h:36</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga23694ffa1ac38dfdfcc1ae1160be7397"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga23694ffa1ac38dfdfcc1ae1160be7397">NVIC_SYSPRI2</a></div><div class="ttdeci">#define NVIC_SYSPRI2</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00026">tSwitch.c:26</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_gade1e623e8a7851917439eeac2019ff3f"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gade1e623e8a7851917439eeac2019ff3f">MEM32</a></div><div class="ttdeci">#define MEM32(addr)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00029">tSwitch.c:29</a></div></div>
<div class="ttc" id="struct__t_task_html"><div class="ttname"><a href="struct__t_task.html">_tTask</a></div><div class="ttdef"><b>Definition:</b> <a href="t_task_8h_source.html#l00031">tTask.h:31</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_gae823575cc1cd55db2bbc40292ec5d9e7"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gae823575cc1cd55db2bbc40292ec5d9e7">saveAndLoadStackAddr</a></div><div class="ttdeci">uint32_t saveAndLoadStackAddr(uint32_t stackAddr)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00074">tSwitch.c:74</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_gab4d6c802c474b9071f48312bed3dec74"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gab4d6c802c474b9071f48312bed3dec74">tTaskEnterCritical</a></div><div class="ttdeci">tTaskCritical_t tTaskEnterCritical(void)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00036">tSwitch.c:36</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_gac66df9e288958f808f7308f40d5ebd66"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gac66df9e288958f808f7308f40d5ebd66">MEM8</a></div><div class="ttdeci">#define MEM8(addr)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00030">tSwitch.c:30</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga0cd2c487eac7429325389fa3ee59867d"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga0cd2c487eac7429325389fa3ee59867d">tTaskSwitch</a></div><div class="ttdeci">void tTaskSwitch(void)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00100">tSwitch.c:100</a></div></div>
<div class="ttc" id="tiny_o_s_8h_html"><div class="ttname"><a href="tiny_o_s_8h.html">tinyOS.h</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga11166a59c430ba34e6da8e20571b58d7"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga11166a59c430ba34e6da8e20571b58d7">NVIC_PENDSVSET</a></div><div class="ttdeci">#define NVIC_PENDSVSET</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00025">tSwitch.c:25</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga21b4efbc4cb710d7d0e71678d2b13e53"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga21b4efbc4cb710d7d0e71678d2b13e53">tTaskExitCritical</a></div><div class="ttdeci">void tTaskExitCritical(tTaskCritical_t status)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00047">tSwitch.c:47</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga3612aa5e26b7da530145fdddce3850ce"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga3612aa5e26b7da530145fdddce3850ce">NVIC_PENDSV_PRI</a></div><div class="ttdeci">#define NVIC_PENDSV_PRI</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00027">tSwitch.c:27</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga0fb8703674b7e263ae5b825af16cbce5"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga0fb8703674b7e263ae5b825af16cbce5">tTaskRunFirst</a></div><div class="ttdeci">void tTaskRunFirst(void)</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00085">tSwitch.c:85</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga6f232fb9d8361d1071e4f621468e0ee1"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga6f232fb9d8361d1071e4f621468e0ee1">currentTask</a></div><div class="ttdeci">tTask * currentTask</div><div class="ttdoc">当前任务：记录当前是哪个任务正在运行 </div><div class="ttdef"><b>Definition:</b> <a href="t_core_8c_source.html#l00017">tCore.c:17</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_gafa1ca44ad548bf5bfa2f19d7438c722a"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#gafa1ca44ad548bf5bfa2f19d7438c722a">NVIC_INT_CTRL</a></div><div class="ttdeci">#define NVIC_INT_CTRL</div><div class="ttdef"><b>Definition:</b> <a href="t_switch_8c_source.html#l00024">tSwitch.c:24</a></div></div>
<div class="ttc" id="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83_html_ga159b80359c1c58e1541a4f037178b6c4"><div class="ttname"><a href="group___xE5_x86_x85_xE6_xA0_xB8_xE6_xA0_xB8_xE5_xBF_x83.html#ga159b80359c1c58e1541a4f037178b6c4">nextTask</a></div><div class="ttdeci">tTask * nextTask</div><div class="ttdoc">下一个将即运行的任务：在进行任务切换前，先设置好该值，然后任务切换过程中会从中读取下一任务信息 ...</div><div class="ttdef"><b>Definition:</b> <a href="t_core_8c_source.html#l00018">tCore.c:18</a></div></div>
</div><!-- fragment --></div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="t_switch_8c.html">tSwitch.c</a></li>
    <li class="footer">Generated by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
